package com.sunny.wordstudy;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import com.sunny.wordstudy.lib.Stat;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ChooseDBView extends Activity
{
  ListView dbList;
  AdapterView.OnItemClickListener dbListHandler = new 1(this);
  Stat iStat = Stat.getInstance();
  ProgressDialog myProgressDialog = null;
  String root = "/sdcard/wordstudy/";
  String sChooseDBFile = null;
  SharedPreferences settings;
  List<Map<String, Object>> studyDbFiles;

  private void setDBStatus()
  {
    TextView localTextView = (TextView)findViewById(2131230720);
    StringBuilder localStringBuilder1 = new StringBuilder(String.valueOf(this.iStat.getStudyBookName())).append(" ");
    Resources localResources1 = getResources();
    Object[] arrayOfObject1 = new Object[2];
    arrayOfObject1[0] = Long.valueOf(this.iStat.getTotalIntroducedWords());
    arrayOfObject1[1] = Long.valueOf(this.iStat.getBookWords());
    StringBuilder localStringBuilder2 = new StringBuilder(String.valueOf(localResources1.getString(2131165189, arrayOfObject1))).append(" ");
    Resources localResources2 = getResources();
    Object[] arrayOfObject2 = new Object[2];
    arrayOfObject2[0] = Long.valueOf(this.iStat.getTotalLearnedTime() / 60L);
    arrayOfObject2[1] = Long.valueOf(this.iStat.getTotalLearnedTime() % 60L);
    localTextView.setText(localResources2.getString(2131165188, arrayOfObject2));
  }

  void getStudyDBList(String paramString)
  {
    this.studyDbFiles = new ArrayList();
    File localFile1 = new File(paramString);
    if (!(localFile1.exists()))
      localFile1.mkdirs();
    File[] arrayOfFile;
    int i;
    if (localFile1.isDirectory())
    {
      arrayOfFile = localFile1.listFiles();
      new String();
      if (!(paramString.equals(this.root)))
      {
        HashMap localHashMap1 = new HashMap();
        localHashMap1.put("item", getResources().getString(2131165206) + "/");
        localHashMap1.put("desc", new String("Directory <<"));
        localHashMap1.put("file", this.root);
        this.studyDbFiles.add(localHashMap1);
        HashMap localHashMap2 = new HashMap();
        localHashMap2.put("item", getResources().getString(2131165206) + "/");
        localHashMap2.put("desc", new String("Directory <<"));
        localHashMap2.put("file", localFile1.getParent());
        this.studyDbFiles.add(localHashMap2);
      }
      i = 0;
      label249: if (i < arrayOfFile.length)
        break label329;
    }
    String[] arrayOfString = new String[2];
    arrayOfString[0] = "item";
    arrayOfString[1] = "desc";
    int[] arrayOfInt = new int[2];
    arrayOfInt[0] = 16908308;
    arrayOfInt[1] = 16908309;
    SimpleAdapter localSimpleAdapter = new SimpleAdapter(this, this.studyDbFiles, 17367044, arrayOfString, arrayOfInt);
    this.dbList.setAdapter(localSimpleAdapter);
    this.dbList.setOnItemClickListener(this.dbListHandler);
    return;
    label329: File localFile2 = arrayOfFile[i];
    if (localFile2.getName().startsWith("usr_"))
    {
      if (!(localFile2.isDirectory()))
        break label437;
      HashMap localHashMap3 = new HashMap();
      localHashMap3.put("item", localFile2.getName().substring(4));
      localHashMap3.put("desc", new String("Directory >>"));
      localHashMap3.put("file", localFile2.getPath());
      this.studyDbFiles.add(localHashMap3);
    }
    while (true)
    {
      ++i;
      break label249:
      label437: if ((!(localFile2.isFile())) || (!(localFile2.getName().endsWith(".edb"))))
        continue;
      String str = this.iStat.getDBSummary(localFile2.getPath());
      if (str.equals("0"))
        continue;
      HashMap localHashMap4 = new HashMap();
      localHashMap4.put("item", localFile2.getName().substring(4) + "  Size:" + String.valueOf(localFile2.length() / 1024L) + "KB");
      localHashMap4.put("desc", str);
      localHashMap4.put("file", localFile2.getPath());
      this.studyDbFiles.add(localHashMap4);
    }
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903040);
    this.settings = PreferenceManager.getDefaultSharedPreferences(this);
    setTitle(getResources().getString(2131165187));
    this.dbList = ((ListView)findViewById(2131230721));
    getStudyDBList(this.root);
    setDBStatus();
  }
}

/* Location:           E:\Desktop\Android\yanguangbeidanci\classes_dex2jar.jar
 * Qualified Name:     com.sunny.wordstudy.ChooseDBView
 * JD-Core Version:    0.5.3
 */